// Copyright (C) 2008 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

#ifndef FLOWRECORD_HH
#define FLOWRECORD_HH

#include <boost/shared_ptr.hpp>
#include <lagniappe/Mutex.h>
#include <assert.h>

namespace state_records
{
  
  enum FlowState {GOOD, MAYBE, DROP}; 

  class FlowRecord
  {
    lagniappe::Mutex * mutex;
    FlowState flowState;
    uint32_t counter;
  public:
    FlowRecord(lagniappe::Mutex * m) : mutex(m), flowState(GOOD), counter(0) {}
    FlowRecord() {assert(false);}
    inline void setState(FlowState fs) {assert(mutex!=NULL); /*mutex->lock();*/ flowState = fs; /*mutex->unlock();*/}
    inline FlowState getState() {assert(mutex!=NULL); /*mutex->lock();*/ FlowState ret = flowState; /*mutex->unlock();*/ return ret;}
    
  };

  typedef boost::shared_ptr<FlowRecord> FlowRecord_p;

}

#endif // FLOWRECORD_HH
